package com.atguigu.dao.impl;

import com.atguigu.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @author 琉
 * @create 2021-09-16 10:16
 */
@Repository
public class AccountDaoImpl implements AccountDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;

    @Override
    public void updateAccountMoney(Integer accountId, Double money) {
       String sql = "update t_account set money=money+? where account_id=?";
        jdbcTemplate.update(sql,money,accountId);
    }

    @Override
    public void updateAccountName(Integer accountId, String accountName) {
       String sql = "update t_account set account_name = ? where account_id=?";
       jdbcTemplate.update(sql,accountName,accountId);
    }
}
